<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/admins/css/yundan.css" rel="stylesheet" type="text/css" />
<?php if($this->ma === 0){
    echo "<script>alert('同一时间有别的商品入库，造成仓库条码冲突，请重新入库！');</script>";
}
?>
<style>
    label.error{color:red}
    

/* -- Form Styles ------------------------------- */
div.fieldset {
	border:  1px solid #afe14c;
	margin: 10px 0;
	padding: 20px 10px;
}
div.fieldset span.legend {
	position: relative;
	background-color: #FFF;
	padding: 3px;
	top: -30px;
	font: 700 14px Arial, Helvetica, sans-serif;
	color: #73b304;
}

div.flash {
	width: 375px;
	margin: 10px 5px;
	border-color: #D9E4FF;

	-moz-border-radius-topleft : 5px;
	-webkit-border-top-left-radius : 5px;
    -moz-border-radius-topright : 5px;
    -webkit-border-top-right-radius : 5px;
    -moz-border-radius-bottomleft : 5px;
    -webkit-border-bottom-left-radius : 5px;
    -moz-border-radius-bottomright : 5px;
    -webkit-border-bottom-right-radius : 5px;

}

.progressWrapper {
	width: 357px;
	overflow: hidden;
}

.progressContainer {
	margin: 5px;
	padding: 4px;
	border: solid 1px #E8E8E8;
	background-color: #F7F7F7;
	overflow: hidden;
}
/* Message */
.message {
	margin: 1em 0;
	padding: 10px 20px;
	border: solid 1px #FFDD99;
	background-color: #FFFFCC;
	overflow: hidden;
}
/* Error */
.red {
	border: solid 1px #B50000;
	background-color: #FFEBEB;
}

/* Current */
.green {
	border: solid 1px #DDF0DD;
	background-color: #EBFFEB;
}

/* Complete */
.blue {
	border: solid 1px #CEE2F2;
	background-color: #F0F5FF;
}

.progressName {
	font-size: 8pt;
	font-weight: 700;
	color: #555;
	width: 323px;
	height: 14px;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
}

.progressBarInProgress,
.progressBarComplete,
.progressBarError {
	font-size: 0;
	width: 0%;
	height: 2px;
	background-color: blue;
	margin-top: 2px;
}

.progressBarComplete {
	width: 100%;
	background-color: green;
	visibility: hidden;
}

.progressBarError {
	width: 100%;
	background-color: red;
	visibility: hidden;
}

.progressBarStatus {
	margin-top: 2px;
	width: 337px;
	font-size: 7pt;
	font-family: Arial;
	text-align: left;
	white-space: nowrap;
}

a.progressCancel {
	font-size: 0;
	display: block;
	height: 14px;
	width: 14px;
	background-image: url(../images/cancelbutton.gif);
	background-repeat: no-repeat;
	background-position: -14px 0px;
	float: right;
}

a.progressCancel:hover {
	background-position: 0px 0px;
}


/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
	vertical-align: top;
}

#returnReason{
    width:600px;
    height:auto;
}

</style>
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>
<form action="/admini/managestore1/instore" method="post" id="ingform">     
    <div class="rukutop">
        <div class="rktopleft" style="width:1000px;">
            <div class="rukuico">
                入库
            </div>
            <div class="rukushuru">
                <table>
                    <tr>
                        <td class="rz">物流信息：</td>
                        <td><div class="inputtext"><input class="input2 w200 required" id="logistics" name="logistics" value="" placeholder="物流号或订单号"/></div>
                            <div class="inputtext"><input class="input2 w80 required" id="logisticName" name="logisticName" value="" placeholder="公司名称"/></div>
                                <select style="width:58px;height:30px;" id="courier">
                                    <option value="圆通">圆通</option>
                                    <option value="申通">申通</option>
                                    <option value="中通">中通</option>
                                    <option value="韵达">韵达</option>
                                    <option value="顺丰">顺丰</option>
                                    <option value="天天">天天</option>
                                    <option value="国通">国通</option>
                                    <option value="汇通">汇通</option>
                                    <option value="优速">优速</option>
                                </select>                   
                        </td>
                    </tr>
                    <tr>
                        <td class="rz">仓库号：</td>
                        <td>
                            <div class="inputtext"><input class="input2 w200 required" id="storeno" name="storeno" value="" /></div>
                            <div class="inputtext" id="usernikename"></div>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="rukushuru" style="color:#c00;padding:8px 0;width: 400px;margin-left: 10px;" id="userRemark">
                
            </div>
        </div>
        <div class="rktopright">
            <div class="rukuxinfo"><p></p></div>
            <div class="kuwei"></div>
        </div>
    </div>
    <div class="rukunr">
        <div class="rkzuo">
            <div class="rk1" >
                <div class="rk1z">
                    <table>
                        <tr>
                            <td class="rkz">包裹信息：</td>
                            <td>
                                <div class="hanggao" id='packageType'></div>
                            </td>
                        </tr>                
                        <tr>
                            <td class="rkz">包裹名称：</td>
                            <td><input class="input3 w400 required" name="productName" id="productName"  value =""/>
                                  <select style="width:196px;height:26px;" id="productselect">
                                    <option value="服装1件">服装1件</option>
                                    <option value="衣服1件">衣服1件</option>
                                    <option value="鞋子1双">鞋子1双</option>
                                    <option value="包包1个">包包1个</option>
                                    <option value="饰品1件">饰品1件</option>
                                    <option value="书1本">书1本</option>
                                    <option value="护肤品1瓶">护肤品1瓶</option>
                                    <option value="手机壳1个">手机壳1个</option>
                                    <option value="眼镜1付">眼镜1付</option>
                                    <option value="公仔1个">公仔1个</option>
                                    <option value="耳机1付">耳机1付</option>
                                    <option value="贴纸1张">贴纸1张</option>
                                    <option value="休闲食品1包">休闲食品1包</option>
                                    <option value="笔1支">笔1支</option>
                                </select> </td>
                        </tr>
                        <tr id="returnReasonBox" style="display:none;width:600px;">
                            <td class="rkz">换货原因：</td>
                            <td style="width:600px;"><div id="returnReason" style="color:red;" style="width:490px;"></div></td>
                        </tr>
                        <tr id="inspection" style="display:none;">
                            <td class="rkz">包裹验货：</td>
                            <td>
                                <div class="rkzc" >
                                    <a class="baocun" href="javascript:inspection();"><span>已验</span></a>
                                    <a class="quxiao" href="javascript:abnormal()" name=""><span>问题</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr class="userInfoRemark" style="display:none;">
                            <td class="rkz">用户备注：</td>
                            <td><textarea name="userqdRemark" id="userqdRemark" class="textarea w600" disabled="disabled"></textarea>
                                <div class="wtms2" id="ingProblemContent" style="display: none;">
                                </div>  
                            </td>
                        </tr>
                        <tr id="qdremark">
                            <td class="rkz">清单备注：</td>
                            <td><textarea name="remark" id="remark" class="textarea w600"></textarea>
                                <div class="wtms2" id="ingProblemContent" style="display: none;">
                                </div>  
                            </td>
                        </tr>
                    </table>
                    <table id="storediv" style="display: block;"> 
                        <tr>
                            <td class="rkz"></td>
                            <td>
                                <div class="wtms3" id="itemProblemContent" style=""></div>
                            </td>
                        </tr>
                        <tr>
                            <td class="rkz">包裹验货：</td>
                            <td>
                                <div class="rkzc" id="bgyh" >
                                    <div class="rkwt" style="display: none;"> <p><i></i>包裹已验货，物品正常</p><a href="javascript:void(0)" class="yzcx" name="">撤销</a></div>
                                    <a class="baocun isExamine" href="javascript:void(0)" name=""><span>已验</span></a>
                                    <a class="quxiao isProblem" href="javascript:void(0)" name=""><span>问题</span></a>
                                    <a class="baocun cultVisiting" href="javascript:void(0)" name="" style="display:none;"><span>结算上门取件</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="rkz">如何处理：</td>
                           <td><label><input name="test" type="radio" value="0" checked />入库</label><label><input name="test" type="radio" value="1" />打包后入库</label></td>
                        </tr>
                    </table>
                    <table id="buyshopdiv" style="display: none;">
                        <tr>
                            <td class="rkz">代购清单：</td>
                            <td class="arrOrder">
                                <div class="dingdan">

                                </div>
                                <div class="wtms3" id="buyProblemContent" style="display: none;"></div>
                            </td>
                        </tr>
                        <tr>
                            <td class="rkz">如何处理：</td>
                            <td><label><input name="test1" type="radio" value="0" checked />入库</label><label><input name="test1" type="radio" value="1" />打包后入库</label></td>
                        </tr>
                    </table>
                </div>
            </div>
                
            <div class="rk2">
                <table>
                    <tr>
                        <td class="rkz">物品重量：</td>
                        <td><input class="input3 w150 required number" value="" id="weight" name="weight" /><b>kg</b></td>
                    </tr>
                    <tr>
                        <td class="rkz">体积重量：</td>
                        <td><input class="input3 w150" value="" id="volumeWeight" value="" name="volumeWeight"  /><b>kg</b>
                            <div class="inforight">
                                <div class="chicun">
                                    <input class="input3 w30" type="text" id="length" value="" name="length" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                    <input class="input3 w30" type="text" value="" id="width" name="width" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                    <input class="input3 w30" type="text" id="height" value="" name="height" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"  /><i>cm</i>
                                    <a class="anvbotton2" href="javascript:void(0)" id="ckvolumeweight"><span>确认</span></a>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="rkz">是否到付：</td>
                        <td><input class="input3 w150" value="" id="cnShipFee" name="cnShipFee"/><b>元</b>
                            <span id="visitNote"></span>
                            <input type="hidden" id="isProblem" name="isProblem" value="0" /> 
                            <input type="hidden" id="isCnShip" name="isCnShip" value="0" />
                        </td>
                    </tr>
                </table>
            </div>
            <div class="rk2">
                <table>
                    <tr>
                        <td class="rkz">包装情况：</td>
                        <td>
                            <ul>
                                <li><label><input id="isPack" name="isPack" type="radio" value="0" checked/>无</label></li>
                                <li><label><input id="isPack" name="isPack" type="radio" value="1" />有包装</label></li>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td class="rkz">能否真空压缩：</td>
                        <td>
                            <ul>
                                <li><label><input id="canVacuum" name="canVacuum" type="radio" value="0" checked/>否</label></li>
                                <li><label><input id="canVacuum" name="canVacuum" type="radio" value="1" />能</label></li>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td class="rkz">产品特征：</td>
                        <td>
                            <ul>
                                <?php foreach ($this->storeArrName as $key => $storeVal) { ?>
                                    <li><label><input name="itemType[]" type="checkbox" id="itemType" value="<?php echo $key;?>"><?php echo $storeVal[0];?></label></li>
                                <?php }?>
                            </ul>
                        </td>
                    </tr>
                    <tr style="display:none">
                        <td class="rkz">标记可走：</td>
                        <td>
                            <ul>
                                <li><label><input name="" type="checkbox" value="" />联邦快递</label></li>
                                <li><label><input name="" type="checkbox" value="" />DHL</label></li>
                                <li><label><input name="" type="checkbox" value="" />DHL仿牌</label></li>
                                <li><label><input name="" type="checkbox" value="" />UPS</label></li>
                                <li><label><input name="" type="checkbox" value="" />新加坡EMS</label></li>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td class="rkz">运输情况：</td>
                        <td>
                            <ul>
                                <li><label><input id="isEmbargo" name="isEmbargo" type="radio" value="0" checked/>可运输</label></li>
                                <li style="width:300px;"><label><input id="isEmbargo" name="isEmbargo" type="radio" value="1" />禁运</label>
                                    <div class="jynr"><input class="inputh w150"  type="text" name="embargoReason" id="embargoReason" /><p style="display:block;">原因</p></div></li>
                            </ul>
                        </td>
                    </tr>
                </table>
            </div>

            <div class="rktj">
                <input type="hidden"  value="" id="storeId" name="storeId" />
                <input type="hidden"  value="" id="orderId" name="orderId" />
                <input type="hidden" id="userid" class="required" name="userid" value=""/>
                <input type="hidden"  value="0" id="bignessType" name="bignessType" />
                <input type="hidden" id="image"  class="required" name="image" title='请上传图片' value="" >
                <input id="intype" name="intype" type="hidden" value="" />
                <div style="display:none;margin: -20px 0px 5px 0px;color: #c00;" class="errorMessage" >异常发错货包裹无需入库</div>
                <ul>
                    <li><a href="javascript:void(0)" class="anvbotton" id="submit"><span>确认入库</span></a></li>
                    <!--<li><a href="javascript:void(0)" class="anvbotton4" id="printcode" style="display:none;"><span>打印编号</span></a></li>
                    <li><a href="javascript:void(0)" class="anvbotton4" id="printstoreno" style="display:none;"><span>打印仓库号</span></a></li>-->
                    <li><a href="javascript:void(0)" class="anvbotton3"><span>重置</span></a></li>
                </ul>
            </div>


        </div>
        <div class="rkyou">
            <div class="paizhao">
                <div class="paizhaotop">
                    <video id="video" width="640px" height="500px" autoplay style="margin-left: -90px;"></video>
                    <img src="" id="showimg" name="showimg" style="display:none;" width="500px" height="500px" />
                    <canvas id="canvas" width="800px" height="800px" style="display: none;"></canvas>
                </div>
                <div class="paizhaocz">
                    <ul style="display:block;">
                        <li><a class="cz4" href="javascript:void(0)" title="本地上传"><i></i>
                                <span id="spanButtonPlaceHolder"></span>
                            </a></li>
                    </ul>
                    <div class="zploading" style="display:none;">
                        <p style="width:50%;"></p><span>50%</span>
                    </div>
                </div>
            </div>
            <div class="paizhaoyl" style='display:none'>
                <div class="zppic">
                    <ul>
                        <li><a class="picbk" href="javascript:void(0)"><img src="/admins/images/zp.png" id="picbkimg1" width="82px" height="80px"/></a>
                            <a href="javascript:void(0)"  title="删除" class="picsc" id="picsc1" name="1" style="display: none;">—</a>
                            <input type="hidden" name="imgurl1" id="imgurl1" value=""/>
                        </li>
                        <li><a class="picbk" href="javascript:void(0)"><img src="/admins/images/zp.png" id="picbkimg2" width="82px" height="80px"/></a>
                            <a href="javascript:void(0)" title="删除" class="picsc" id="picsc2" name="2" style="display: none;">—</a>
                            <input type="hidden" name="imgurl2" id="imgurl2" value=""/>
                        </li>
                        <li><a class="picbk" href="javascript:void(0)"><img src="/admins/images/zp.png" id="picbkimg3" width="82px" height="80px"/></a>
                            <a href="javascript:void(0)" title="删除" class="picsc" id="picsc3" name="3" style="display: none;">—</a>
                            <input type="hidden" name="imgurl3" id="imgurl3" value=""/>
                        </li>
                        <li><a class="picbk" href="javascript:void(0)"><img src="/admins/images/zp.png" id="picbkimg4" width="82px" height="80px"/></a>
                            <a href="javascript:void(0)" title="删除" class="picsc" id="picsc4" name="4" style="display: none;">—</a>
                            <input type="hidden" name="imgurl4" id="imgurl4" value=""/>
                        </li>
                        <li><a class="picbk" href="javascript:void(0)"><img src="/admins/images/zp.png" id="picbkimg5" width="82px" height="80px"/></a>
                            <a href="javascript:void(0)" title="删除" class="picsc" id="picsc5" name="5" style="display: none;">—</a>
                            <input type="hidden" name="imgurl5" id="imgurl5" value=""/>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="fieldset flash" id="fsUploadProgress"  style="" >
                <span class="legend"></span>
            </div>
            <div id="divStatus">0 Files Uploaded</div>
            <div>
                <span id="stt"></span></br>
                <input id="btnCancel" type="button" value="Cancel All Uploads" onclick="swfu.cancelQueue();" disabled="disabled"  style="display:none;"  />
            </div>
        </div>
    </div>
<!--</form>-->

<div class="tanchuang" style="width: 760px;display:none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd">包裹操作</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
    	<div class="wt_nav">
            <ul>
            	<li class="wt_on" style="display:none;" name="orderProblem"><a href="javascript:void(0)">代购包裹问题</a></li>
                <li style="display:none;" name="orderItemProblem"><a href="javascript:void(0)">代购商品问题</a></li>
                <li style="display:none;" name="ingProblem"><a href="javascript:void(0)" >预报包裹问题</a></li>
                <li style="display:none;" name="rerProblem"><a href="javascript:void(0)">换货包裹问题</a></li>
                <li style="display:none;" name="orderProblemShow"><a href="javascript:void(0)">代购问题展示</a></li>
                <li style="display:none;" name="visitingShipFee"><a href="javascript:void(0)">上门取件运费计算</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box" id="isProblemConent" style="display: none;">
        <div class="wt_center" style="height:280px;overflow: auto;">
            
        </div>
        <div class="wt_type" style="height:30px;width: 100%;">
            <ul>
                <li style="float: left;width: 70px;padding: 5px 0;margin-left: 10px;">
                    <label>问题类型：</label></li>
                <li style="float: left;width: 90px;padding: 5px 0;">
                    <label><input id="isAbnormal1" name="isAbnormal" type="radio" value="<?php echo Application_Model_Order::Abnormal_Less;?>" checked="checked">少货</label></li>
                <li style="float: left;width: 90px;padding: 5px 0;">
                    <label><input id="isAbnormal2" name="isAbnormal" type="radio" value="<?php echo Application_Model_Order::Abnormal_Error;?>">发错货</label></li>
                <li style="float: right;width: 120px;margin-top: -10px;margin-right: 10px;" class="uploadProblemImg">
                    <a href="javascript:void(0)" class="anvbotton3"><span id="spanButtonPlaceHolder_ProblemImg"></span></a></li>
            </ul>
        </div>
        <div class="wt_caozuo" style="width:738px;">
            <textarea name="problemContent" cols="" rows="" id="problemContent" style="width:670px;"></textarea>
            <input type="hidden" id="orderProblemId" name="orderProblemId" value="" />
            <input type="hidden" id="orderProblemImg" name="orderProblemImg" value="" />
            <a class="wt_liuyan" id="subIsProblem" href="javascript:void(0);"><span>设置</span></a>
        </div>
    </div>
    <div class="problem_box" style="display: none;">
        <div class="problem_center" style="height:350px;overflow: auto;padding: 10px;">
            
        </div>
    </div>
    <div class="cultShipFee" style="display:none;">
        <div class="wt_center table" style="width:700px;">
            <table>
                <tr class='content_bottom'>
                    <td style="width: 150px;text-align: right;padding-right: 20px;">类型：</td>
                    <td style="width: 420px;" class="w0 visitingType"><span></span></td>
                </tr>
                <tr class='content_bottom'>
                    <td style="width: 150px;text-align: right;padding-right: 20px;">总重量：</td>
                    <td style="width: 420px;" class="w0">
                        <input type="text" id="visitingWeight" name="visitingWeight" value="" class="input3"/>&nbsp;&nbsp;kg
                        <span style="font-size:12px;color: #c00;">包含箱子的重量</span>
                    </td>
                </tr>
                <tr class='content_bottom'>
                    <td style="width: 150px;text-align: right;padding-right: 20px;">周长：</td>
                    <td style="width: 420px;" class="w0">
                        <div class="chicun">
                            <input class="input3 w30" type="text" id="visitingLength" value="" name="visitingLength" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"><i>X</i>
                            <input class="input3 w30" type="text" value="" id="visitingWidth" name="visitingWidth" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"><i>X</i>
                            <input class="input3 w30" type="text" id="visitingHeight" value="" name="visitingHeight" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"><i>cm</i>
                        </div><span style="font-size:12px;color: #c00;">箱子的长宽高</span></td>
                </tr>
                <tr class='content_bottom'>
                    <td style="width: 150px;text-align: right;padding-right: 20px;">总体积：</td>
                    <td style="width: 420px;" class="w0">
                        <input type="text" id="visitingVolumeWeight" name="visitingVolumeWeight" value="" class="input3"/>&nbsp;&nbsp;kg 
                        <a href="javascript:void(0)" class="indexa visitingCult" >计算国内运费</a>
                    </td>
                </tr>
                <tr class='content_bottom'>
                    <td style="width: 150px;text-align: right;padding-right: 20px;">国内运费：</td>
                    <td style="width: 420px;" class="w0">
                        <input type="text" id="visitingFee" name="visitingFee" value="" class="input3"/>&nbsp;&nbsp;元</td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div class="lctijiao" style="width: 100px;float: left;margin-left: 100px;">
                            <input type="hidden" id="visitingId" name="visitingId" value="" />
                            <a class="anvbotton5" href="javascript:void(0)" id="subVisitingFee"><span>确认</span></a>
                        </div>
                        <div class="" style="width: 50px;float: left;padding-top: 12px;">
                            <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>
<script type="text/javascript" src="/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="/js/swfupload/plugins/swfupload.queue.js"></script>
<script src='/js/swfupload/fileprogress.js'></script>
<script src='/js/swfupload/handlers.js'></script>
<script>
    var isSubmit = true;
        function checkForm(){
            var weight = $.trim($('#weight').val());            
            if($('#storeno').val().substr(0,1)=='F' && $('#intype').val()!= '代购订单'){
                alert('这是一个无关联信息的代购订单,请暂缓入库,并联系管理员更新代购信息');
                return false;
            }
            if($("#isCnShip").val() == 1) {
                if($('#cnShipFee').val().length < 1){
                    var packageType = $('#packageType').html();
                    var filter  = /上门取件/gi;
                    if(filter.test(packageType)){
                        alert("上门取件包裹请填写到付金额！");
                        return flase;
                    }   
                }
            }
            if(weight>100){
                if(confirm("您确定该商品重量为"+weight+"KG","提示信息")){  
                    $("#submit").attr("disabled", true);
                    $("#ingform").submit();
                }
            }else{
                $("#submit").attr("disabled", true);
                $("#ingform").submit();
            }
        } 
        $("#ingform").submit(function(){
            if($("#ingform").valid()){    
                //$("#ingform").attr("disabled","disabled"); 
                $('#submit').unbind('click');
            }
        });
        $(function () {
            $.fn.numeral = function () {
                    $(this).css("ime-mode", "disabled");
                    this.bind("keypress", function (e) {
                        var code = (e.keyCode ? e.keyCode : e.which);  //兼容火狐 IE   
                        if (!$.browser.msie && (e.keyCode == 0x8))  //火狐下 不能使用退格键  
                        {
                            return;
                        }
                        return code >= 48 && code <= 57 || code == 46;
                    });
                    this.bind("blur", function () {
                        if (this.value.lastIndexOf(".") == (this.value.length - 1)) {
                            this.value = this.value.substr(0, this.value.length - 1);
                        } else if (isNaN(this.value)) {
                            this.value = " ";
                        } 
                    });
                    this.bind("paste", function () {
                        var s = clipboardData.getData('text');
                        if (!/\D/.test(s));
                        value = s.replace(/^0*/, '');
                        return false;
                    });
                    this.bind("dragenter", function () {
                        return false;
                    });
                    this.bind("keyup", function () {
                        this.value = this.value.replace(/[^\d.]/g, "");
                        //必须保证第一个为数字而不是.
                        this.value = this.value.replace(/^\./g, "");
                        //保证只有出现一个.而没有多个.
                        this.value = this.value.replace(/\.{2,}/g, ".");
                        //保证.只出现一次，而不能出现两次以上
                        this.value = this.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
                    });
                };
            $("#weight").numeral();
            $("#volumeWeight").numeral();
            $('#ingform').validate();
            $('#submit').click(function(){
                checkForm();
            });
        });
        $(".picsc").live("click",function(){
            var delid = $(this).attr("name");
            var delimgname = $("#picbkimg"+delid).attr("name");
            $.ajax({
                url: "/admini/ajax/deldir",
                type: "post",
                data: { dir: delimgname },
                async: true,
                success: function (redata) {
                    if(redata == 1){
                        $("#picbkimg"+delid).attr("src","/admins/images/zp.png");
                        $("#picsc"+delid).hide();
                        $("#imgurl"+delid).attr("val","");
                        arrimg[delid] = false;
                    }else{
                        alert("出现未知错误");
                    }
                }
            });
        });
        $("#embargoReason").focusin(function(){
            $(".jynr p").hide();
        });
        $("#embargoReason").focusout(function(){
            if($(this).val() == ""){
                $(".jynr p").show();
            }
        });
        $('.rukushuru label').click(function(){
            $(this).parent().find('input').focus();
        });
        $('#storeno').focusout(function(){
            var storeno = $(this).val();
            if(storeno == "")
                return ;
            $('#packageType').text('正在获取信息,请稍候...');
            $.post('/admini/managestore/userinfo', {'storeno':storeno}, function(data){
                if(!data){
                    alert('没有找到该仓库号对应的用户信息,请检查仓库号是否输入正确');
                    $('#storeno').val("");
                    $('#storeno').focus();
                    return;
                }
                $("#isCnShip").val("0");
                $("#buyshopdiv").hide();
                $("#productselect").hide();
                $("#returnReasonBox").hide();
                $(".wt_type ul li").hide();
                $(".userInfoRemark").hide();
                $(".cultVisiting").hide();
                $(".uploadProblemImg").show();
                $("#storediv").show();
                $("#qdremark").show();
                $('#visitNote').html("");
                switch(data.type){
                    case 0:
                        $('#intype').val('自助包裹');
                        $('#packageType').text('自助包裹');
                        $(".rukuxinfo").html("");
                        $("#productselect").show();
                        $("#productName").val("");
                        $("#remark").val("");
                        $(".kuwei").html("");
                        $(".rkwt").hide();
                        $(".isExamine").show();
                        $(".isProblem").hide();
                        $(".rkzc .rkwt").show();
                        $(".rkzc .isExamine").hide();
                        $(".rkzc .yzcx").hide();
                        break;
                    case 1:
                        $('#intype').val('代购订单');
                        $("#productselect").hide();
                        $(".wt_type ul li").show();
                        var checkhtml = "代购订单<span style='margin-left:20px;'><input type='checkbox' id='issplitbox' name='issplitbox' />多次入库</span>";
                        $('#packageType').html(checkhtml);
                        $('#storeId').val(data.storeid);  
                        $("#productName").val("");
                        var buyshopdetail = "";
                        var i = 0;
                        var OrderNum;
                        $.each(data.arrOrder,function(orderKey,orderVal) {
                                OrderNum = orderVal.storeid;
                                if(i == 0 || orderVal.isSel==1){
                                    $("#productName").val("代购订单"+OrderNum+"物品入库");
                                    $('#storeId').val(orderKey); 
                                    $('#orderId').val(orderKey); 
                                }
                                buyshopdetail += '<div class="dingdan" style="'+ (i>0?'margin-top: 25px;':'')+'"><div class="ddinfo"><p><span>';
                                if(orderVal.status != <?php echo Application_Model_Order::STATUS_INSTORE;?> && orderVal.status != <?php echo Application_Model_Order::STATUS_CANCEL;?>){
                                    buyshopdetail += '<input type="radio" id="choiceOrderId'+orderKey+'" name="choiceOrderId" value="'+orderKey+'" i="代购订单'+OrderNum+'物品入库" '+(orderVal.isSel==1?"checked":(i == 0?"checked":""))+'/>';
                                }
                                buyshopdetail += '</span><span>订单编号：'+orderVal.storeid+'</span><span>付款时间：'+orderVal.dateCreated+'</span></p>';
                                buyshopdetail += '<a class="fch isProblem" href="javascript:void(0)" i="'+orderKey+'" name="orderProblem"><span>问题<font '+(orderVal.problemNum>0?"style='color:#c00;'":"")+'">('+orderVal.problemNum+')</font></span></a>';
                                if(orderVal.arrProblem != ""){
                                    buyshopdetail += '<div class="ydtishi"><a class="ts3 showProblem" href="javascript:void(0)" title="问题代购" name="'+orderKey+'">问题代购</a></div>';
                                }
                                buyshopdetail+= '</div>';
                                $.each(orderVal.orderdetail, function(itemKet, itemVal) {
                                    if (orderVal.status == <?php echo Application_Model_Order::STATUS_INSTORE;?> && itemVal.ckPass != <?php echo Application_Model_DomainobjectType::CK_Problem;?>){
                                        buyshopdetail+= '<div class="ddx yy" id="div'+itemVal.id+'"><table style="width: 100%;">';
                                    } else {
                                        buyshopdetail+= '<div class="ddx" id="div'+itemVal.id+'"><table style="width: 100%;">';
                                    }
                                    buyshopdetail+= '<tr id="tr'+itemVal.id+'"><td class="r1">';
                                    if(itemVal.problemNum > 0){
                                        buyshopdetail+= '<span class="wtj" title="问题物品">问题</span>';
                                    } else if (orderVal.status == <?php echo Application_Model_Order::STATUS_INSTORE;?> && itemVal.ckPass != <?php echo Application_Model_DomainobjectType::CK_Problem;?>){
                                        buyshopdetail+= '<span class="yiyan">已验</span>';
                                    }
                                    buyshopdetail+= '</td><td class="r2"><div class="sp_pic"><a href="'+itemVal.remoteImage+'" target="_blank"><img src="'+itemVal.remoteImage+'" alt="商品名称" /></a>';
                                    buyshopdetail+= '</div><div class="sp_info"><h1><a href="'+itemVal.tgurl+'" target="_blank" id="shopProductName'+itemVal.id+'" >'+itemVal.productName+'</a></h1><div class="zdy"><span>'+itemVal.PropertyAlias+'</span>';
                                    if(itemVal.description != null && itemVal.description != ""){
                                        buyshopdetail+= '<span style="color:#c00">悠奇备注:'+itemVal.description+'</span>';
                                    }
                                    buyshopdetail+= '</div><div class="Remarks"><p>'+itemVal.comment+'</p></div></div></td><td class="r3">￥'+itemVal.price+'</td>';
                                    buyshopdetail+= '<td class="r4">'+itemVal.quantity+'</td><td class="r5">';
                                    if(itemVal.status == 1){
                                        buyshopdetail+= '<dt><span style="color:#c00;">已单项退款</span></dt>';
                                    }else{
                                        
                                        if(orderVal.status != <?php echo Application_Model_Order::STATUS_INSTORE;?> && orderVal.status != <?php echo Application_Model_Order::STATUS_CANCEL;?>){
                                            buyshopdetail+= '<a class="yzcx" href="javascript:void(0)" name="'+itemVal.id+'" style="display:none;">撤销</a>';
                                            buyshopdetail+= '<dl><dt><a class="baocun itemExamine" href="javascript:void(0)" name="'+itemVal.id+'" style="margin-right: 0px;"><span>已验</span></a></dt>';
                                            buyshopdetail+= '<dd><a class="quxiao isProblem" href="javascript:void(0)" name="orderItemProblem" i="'+itemVal.id+'" style="margin-right: 0px;"><span style="padding: 0 5px;">问题<font '+(itemVal.problemNum>0?"style='color:#c00;'":"")+'">('+itemVal.problemNum+')</font></span></a></dd></dl>';
                                        } else {
                                            if(itemVal.ckPass == <?php echo Application_Model_DomainobjectType::CK_Problem;?>){
                                                buyshopdetail+= '<a class="yzcx" href="javascript:void(0)" name="'+itemVal.id+'" style="display:none;">撤销</a>';
                                                buyshopdetail+= '<dl><dt><a class="baocun itemExamine" href="javascript:void(0)" name="'+itemVal.id+'" style="margin-right: 0px;"><span>已验</span></a></dt>';
                                                buyshopdetail+= '<dd><a class="quxiao isProblem" href="javascript:void(0)" name="orderItemProblem" i="'+itemVal.id+'" style="margin-right: 0px;"><span style="padding: 0 5px;">问题<font '+(itemVal.problemNum>0?"style='color:#c00;'":"")+'">('+itemVal.problemNum+')</font></span></a></dd></dl>';
                                            } else {
                                                buyshopdetail+= '<dt><span style="color:#c00;">已入库</span></dt>';
                                            }
                                        }
                                    }                        
                                    buyshopdetail+= '</td></tr></table>';
                                    buyshopdetail+= '</div>';
                                });
                                buyshopdetail+= '</div>'
                                buyshopdetail += '<div class="wtms3 orderProblemContent" name="'+orderKey+'" ></div><div class="rkyw" id="bgyh" name="'+orderKey+'" style=""></div>';
                                buyshopdetail+= '</div>'
                                i++;
                            });
                            $(".arrOrder").html(buyshopdetail);
                            $("#buyshopdiv").show();
                            $("#storediv").hide();
                            $("#qdremark").hide();
                            $("#productselect").hide();
                        
                        break;
                    case 2:
                        $('#intype').val('上门取件');
                        $(".isExamine").show();
                        $(".userInfoRemark #userqdRemark").val(data.addtion.description);
                        $(".userInfoRemark").show();
                        $(".isProblem").hide();
                        $("#productselect").hide();
                        $('#packageType').text('上门取件');
                        $('#productName').val(data.addtion.name);
                        $(".rkzc .rkwt").show();
                        $(".rkzc .isExamine").hide();
                        $(".rkzc .yzcx").hide();
                        if(!data.addtion.isInStore){
                            $(".visitingType span").html('上门取件'+"-"+data.addtion.expressName);
                            $("#visitingId").val(data.addtion.vistingId);
                            $(".cultShipFee").show();
                            $(".tanchuang").show();
                            $(".houtai_overlay").show();
                            $(".cultVisiting").show();
                            $(".wt_nav li").removeClass("wt_on");
                            $(".wt_nav li[name='visitingShipFee']").addClass("wt_on").show();
                            $("#isCnShip").val("1");
                            $('#visitNote').html('<font color="red">上门取件包裹，请填写到付金额</font>');
                        }
                        break;
                    case 3:
                        $('#intype').val('上门取件');
                        $(".isExamine").show();
                        $(".userInfoRemark #userqdRemark").val(data.addtion.description);
                        $(".userInfoRemark").show();
                        $(".isProblem").hide();
                        $("#productselect").hide();
                        $('#packageType').html('上门取件<span style="color:#c00;">(直发海外)</span>');
                        $('#productName').val(data.addtion.name);
                        $(".rkzc .rkwt").show();
                        $(".rkzc .isExamine").hide();
                        $(".rkzc .yzcx").hide();
                        if(!data.addtion.isInStore){
                            $(".visitingType span").html('上门取件'+"-"+data.addtion.expressName);
                            $("#visitingId").val(data.addtion.vistingId);
                            $(".cultShipFee").show();
                            $(".tanchuang").show();
                            $(".houtai_overlay").show();
                            $(".cultVisiting").show();
                            $(".wt_nav li").removeClass("wt_on");
                            $(".wt_nav li[name='visitingShipFee']").addClass("wt_on").show();
                            $("#isCnShip").val("1");
                            $('#visitNote').html('<font color="red">上门取件包裹，请填写到付金额</font>');
                        }
                        break;    
                }
                
                var userdetail = '<p>当前库存：<a href="/admini/managestore/index/quick/'+storeno+'">'+data.countstore+'</a>';
                    userdetail+= '<span>|</span>帐号：<a href="javascript:void(0)">'+data.email+'</a>';
                    userdetail+= '<span>|</span>昵称：<a href="javascript:void(0)" id="usernikename">'+data.nikeName+'</a>';
                    userdetail+= '<span>|</span>用户ID：'+data.userid+'</p>';
                $(".rukuxinfo").html(userdetail);
                $('#userid').val(data.userid);
                $('div#loginstoreno').text(storeno.toUpperCase());
                $('div#loginname').text(data.nikeName);
                if(data.userRemark){
                    $('div#userRemark').text("用户备注："+data.userRemark);
                }
                $('div#usernikename').text(data.nikeName);
                $('div#dq').text(data.dq);
                var kuwei = '';
                var kwtj = "";
                if(data.storeLocation == 0){
                    kuwei+= '<li>悠奇个人云仓库</li>';
                    kwtj = '<li>无</li>';
                }else{
                    $.each(data.storeLocation, function(key, val) {
                        kuwei+= '<li><i></i>'+val+'</li>';
                        kwtj+= '<li><input class="input3 w30" type="text" value="'+val+'" style="width:40px;"/></li>';
                    });
                }
                kuwei+= '</ul>';
                $(".kuwei").html("<label>现有库位：</label><ul>"+kuwei);
                $(".rkzuo ul.kwtj").html(kwtj);
                $("#printform ul.kwtj").html(kuwei);
                $('#userinfo').text('帐号:'+data.email+' 用户ID：'+data.userid+' 昵称:'+data.nikeName);
            }, 'json');
            
        });
        $("input[type='radio'][name='choiceOrderId']").live("click",function(){
            var OrderNum = $(this).attr("i");
            $("#productName").val(OrderNum);
        });
        $("#logistics").focusout(function(){
            if($(this).val() != ""){
                $("#storediv #quxiao").attr("name",$(this).val());
                $('#packageType').text('正在获取信息,请稍候...');
                $.post('/admini/managestore/logisticsinfo', {'shipNo':$(this).val()}, function(data){
                    $('#packageType').html(data.infoArr.intype);
                    $("#buyshopdiv").hide();
                    $("#productselect").hide();
                    $("#returnReasonBox").hide();
                    $(".wt_type ul li").hide();
                    $(".userInfoRemark").hide();
                    $(".cultVisiting").hide();
                    $(".uploadProblemImg").show();
                    $("#storediv").show();
                    $("#qdremark").show();
                    $("#intype").val(data.infoArr.intype);
                    $('#visitNote').html("");
//                    $('#orderId').val(data.infoArr.storeid); 
//                    $("#storeno").bind("focusout");
                    switch(data.infoArr.intype){
                        case "自助包裹":
                            $(".rukuxinfo").html("");
                            $("#productselect").show();
                            $("#productName").val("");
                            $("#remark").val("");
                            $("#storeno").val("");
                            $(".kuwei").html("");
                            $(".rkwt").hide();
                            $(".isExamine").show();
                            $(".isProblem").hide();
                            $(".rkzc .rkwt").show();
                            $(".rkzc .isExamine").hide();
                            $(".rkzc .yzcx").hide();
                            return ;
                            break;
                        case "上门取件":
                            $("#productName").val(data.infoArr.waresName);
                            $(".userInfoRemark #userqdRemark").val(data.infoArr.waresDescribe);
                            $(".userInfoRemark").show();
                            $(".isProblem").hide();
                            $(".rkzc .rkwt").show();
                            $(".rkzc .isExamine").hide();
                            $(".rkzc .yzcx").hide();
                            if(!data.infoArr.isInStore){
                                $(".visitingType span").html(data.infoArr.intype+"-"+data.infoArr.expressName);
                                $("#visitingId").val(data.infoArr.storeid);
                                $(".cultShipFee").show();
                                $(".tanchuang").show();
                                $(".houtai_overlay").show();
                                $(".cultVisiting").show();
                                $(".wt_nav li").removeClass("wt_on");
                                $(".wt_nav li[name='visitingShipFee']").addClass("wt_on").show();
                                $("#isCnShip").val("1");
                                $('#visitNote').html('<font color="red">上门取件包裹，请填写到付金额</font>');
                            }
                            break;
                        case "预报包裹":
                            $("#productName").val(data.infoArr.name);
                            $('#storeId').val(data.infoArr.storeid);
                            $(".userInfoRemark #userqdRemark").val(data.infoArr.remark);
                            $(".userInfoRemark").show();
                            $(".isProblem").hide();
                            $(".rkzc .rkwt").show();
                            $(".rkzc .isExamine").hide();
                            $(".rkzc .yzcx").hide();
                            break;
                        case "代购订单":
                            var checkhtml = "代购订单<span style='margin-left:20px;'><input type='checkbox' id='issplitbox' name='issplitbox' />多次入库</span>";
                            $('#packageType').html(checkhtml);
                            $("#productName").val("");
                            $(".wt_type ul li").show();
//                            $("#storeno").unbind("focusout");
                            var buyshopdetail = "";
                            var i = 0;
                            var OrderNum;
                            $.each(data.infoArr.orderArr,function(orderKey,orderVal) {
                                OrderNum = orderVal.storeid;
                                if(i == 0 || orderVal.isSel==1){
                                    $("#productName").val("代购订单"+OrderNum+"物品入库");
                                    $('#storeId').val(orderKey); 
                                    $('#orderId').val(orderKey); 
                                }
                                buyshopdetail += '<div class="dingdan" style="'+ (i>0?'margin-top: 25px;':'')+'"><div class="ddinfo"><p><span>';
                                if(orderVal.status != <?php echo Application_Model_Order::STATUS_INSTORE;?> && orderVal.status != <?php echo Application_Model_Order::STATUS_CANCEL;?>){
                                    buyshopdetail += '<input type="radio" id="choiceOrderId'+orderKey+'" name="choiceOrderId" value="'+orderKey+'" i="代购订单'+OrderNum+'物品入库" '+(orderVal.isSel==1?"checked":(i == 0?"checked":""))+'/>';
                                }
                                buyshopdetail += '</span><span>订单编号：'+orderVal.storeid+'</span><span>付款时间：'+orderVal.dateCreated+'</span></p>';
                                buyshopdetail += '<a class="fch isProblem" href="javascript:void(0)" i="'+orderKey+'" name="orderProblem"><span>问题<font '+(orderVal.problemNum>0?"style='color:#c00;'":"")+'">('+orderVal.problemNum+')</font></span></a>';
                                if(orderVal.arrProblem != ""){
                                    buyshopdetail += '<div class="ydtishi"><a class="ts3 showProblem" href="javascript:void(0)" title="问题代购" name="'+orderKey+'">问题代购</a></div>';
                                }
                                buyshopdetail+= '</div>';
                                $.each(orderVal.orderdetail, function(itemKet, itemVal) {
                                    if (orderVal.status == <?php echo Application_Model_Order::STATUS_INSTORE;?> && itemVal.status == 0){
                                        buyshopdetail+= '<div class="ddx yy" id="div'+itemVal.id+'"><table style="width: 100%;">';
                                    } else {
                                        buyshopdetail+= '<div class="ddx" id="div'+itemVal.id+'"><table style="width: 100%;">';
                                    }
                                    buyshopdetail+= '<tr id="tr'+itemVal.id+'"><td class="r1">';
                                    if(itemVal.problemNum > 0){
                                        buyshopdetail+= '<span class="wtj" title="问题物品">问题</span>';
                                    } else if (orderVal.status == <?php echo Application_Model_Order::STATUS_INSTORE;?> && itemVal.status == 0){
                                        buyshopdetail+= '<span class="yiyan">已验</span>';
                                    }
                                    buyshopdetail+= '</td><td class="r2"><div class="sp_pic"><a href="'+itemVal.remoteImage+'" target="_blank"><img src="'+itemVal.remoteImage+'" alt="商品名称" /></a>';
                                    buyshopdetail+= '</div><div class="sp_info"><h1><a href="'+itemVal.tgurl+'" target="_blank" id="shopProductName'+itemVal.id+'" >'+itemVal.productName+'</a></h1><div class="zdy"><span>'+itemVal.PropertyAlias+'</span>';
                                    if(itemVal.description != null && itemVal.description != ""){
                                        buyshopdetail+= '<span style="color:#c00">悠奇备注:'+itemVal.description+'</span>';
                                    }
                                    buyshopdetail+= '</div><div class="Remarks"><p>'+itemVal.comment+'</p></div></div></td><td class="r3">￥'+itemVal.price+'</td>';
                                    buyshopdetail+= '<td class="r4">'+itemVal.quantity+'</td><td class="r5">';
                                    if(itemVal.status == <?php echo Application_Model_OrderItem::Status_Refund;?>){
                                        buyshopdetail+= '<dt><span style="color:#c00;">已单项退款</span></dt>';
                                    }else{
                                        if(orderVal.status != <?php echo Application_Model_Order::STATUS_INSTORE;?> && orderVal.status != <?php echo Application_Model_Order::STATUS_CANCEL;?>){
                                            buyshopdetail+= '<a class="yzcx" href="javascript:void(0)" name="'+itemVal.id+'" style="display:none;">撤销</a>';
                                            buyshopdetail+= '<dl><dt><a class="baocun itemExamine" href="javascript:void(0)" name="'+itemVal.id+'" style="margin-right: 0px;"><span>已验</span></a></dt>';
                                            buyshopdetail+= '<dd><a class="quxiao isProblem" href="javascript:void(0)" name="orderItemProblem" i="'+itemVal.id+'" style="margin-right: 0px;"><span style="padding: 0 5px;">问题<font '+(itemVal.problemNum>0?"style='color:#c00;'":"")+'">('+itemVal.problemNum+')</font></span></a></dd></dl>';
                                        } else {
                                            if(itemVal.status > <?php echo Application_Model_OrderItem::Status_Refund;?>){
                                                buyshopdetail+= '<a class="yzcx" href="javascript:void(0)" name="'+itemVal.id+'" style="display:none;">撤销</a>';
                                                buyshopdetail+= '<dl><dt><a class="baocun itemExamine" href="javascript:void(0)" name="'+itemVal.id+'" style="margin-right: 0px;"><span>已验</span></a></dt>';
                                                buyshopdetail+= '<dd><a class="quxiao isProblem" href="javascript:void(0)" name="orderItemProblem" i="'+itemVal.id+'" style="margin-right: 0px;"><span style="padding: 0 5px;">问题<font '+(itemVal.problemNum>0?"style='color:#c00;'":"")+'">('+itemVal.problemNum+')</font></span></a></dd></dl>';
                                            } else {
                                                
                                                buyshopdetail+= '<dt><span style="color:#c00;">已入库</span></dt>';
                                            }
                                        }
                                    }                        
                                    buyshopdetail+= '</td></tr></table>';
                                    buyshopdetail+= '</div>';
                                });
                                buyshopdetail+= '</div>'
                                buyshopdetail += '<div class="wtms3 orderProblemContent" name="'+orderKey+'" ></div><div class="rkyw" id="bgyh" name="'+orderKey+'" style=""></div>';
                                buyshopdetail+= '</div>'
                                i++;
                            });
                            $(".arrOrder").html(buyshopdetail);
                            $("#buyshopdiv").show();
                            $("#storediv").hide();
                            $("#qdremark").hide();
                            $("#productselect").hide();
                            break;
                        case "网购包裹":
                            var checkhtml = "网购包裹";
                            $('#packageType').html(checkhtml);
                            $("#productName").val("");
                            $(".wt_type ul li").show();
                            var buyshopdetail = "";
                            var i = 0;
                            $.each(data.infoArr.orderArr,function(orderKey,orderVal) {
                                if(i == 0 || orderVal.isSel==1){
                                    $("#productName").val('自助网购包裹'+orderVal.storeid+'物品入库');
                                    $('#storeId').val(orderKey); 
                                    $('#orderId').val(orderKey); 
                                }
                                buyshopdetail += '<div class="dingdan" style="'+ (i>0?'margin-top: 25px;':'')+'"><div class="ddinfo"><p><span>';
                                if(orderVal.status != <?php echo Application_Model_ingstore::STATE_OUT;?> && orderVal.status != <?php echo Application_Model_ingstore::STATE_IN;?>){
                                    buyshopdetail += '<input type="radio" id="choiceOrderId'+orderKey+'" name="choiceOrderId" value="'+orderKey+'" i="自助网购包裹'+orderVal.storeid+'物品入库" '+(orderVal.isSel==1?"checked":(i == 0?"checked":""))+'/>';
                                }
                                buyshopdetail += '</span><span>预报号：'+orderVal.storeid+'</span><span>提交时间：'+orderVal.dateCreated+'</span></p>';

                                buyshopdetail += '<a class="fch isProblem" href="javascript:void(0)" i="'+orderKey+'" name="onlineProblem"><span>问题<font '+(orderVal.problemNum>0?"style='color:#c00;'":"")+'">('+orderVal.problemNum+')</font></span></a>';
                                if(orderVal.arrProblem != ""){
                                    buyshopdetail += '<div class="ydtishi"><a class="ts3 showProblem" href="javascript:void(0)" title="问题代购" name="'+orderKey+'">问题代购</a></div>';
                                }
                                buyshopdetail+= '</div>';
                                $.each(orderVal.orderdetail, function(itemKet, itemVal) {
                                    //$('#orderId').val(itemVal.id); 
                                    if (orderVal.status == <?php echo Application_Model_ingstore::STATE_IN;?> && itemVal.status == 0){
                                        buyshopdetail+= '<div class="ddx yy" id="div'+itemVal.id+'"><table style="width: 100%;">';
                                    } else {
                                        buyshopdetail+= '<div class="ddx" id="div'+itemVal.id+'"><table style="width: 100%;">';
                                    }
                                    buyshopdetail+= '<tr id="tr'+itemVal.id+'"><td class="r1">';
                                    if(itemVal.problemNum > 0){
                                        buyshopdetail+= '<span class="wtj" title="问题物品">问题</span>';
                                    } else if (orderVal.status == <?php echo Application_Model_Order::STATUS_INSTORE;?> && itemVal.status == 0){
                                        buyshopdetail+= '<span class="yiyan">已验</span>';
                                    }
                                    buyshopdetail+= '</td><td class="r2"><div class="sp_pic"><a href="'+itemVal.remoteImage+'" target="_blank"><img src="'+itemVal.remoteImage+'" alt="商品名称" /></a>';
                                    var str = "";
                                    if(itemVal.PropertyAlias){
                                        $.each(itemVal.PropertyAlias, function (name, value) {
                                            str +=name + ":" + value +";";
                                        });
                                    }
                                    buyshopdetail+= '</div><div class="sp_info"><h1><a href="'+itemVal.tgurl+'" target="_blank" id="shopProductName'+itemVal.id+'" >'+itemVal.productName+'</a></h1><div class="zdy"><span>';
                                    if(str !=="")
                                    {
                                    buyshopdetail+='颜色尺寸：'+ str +'</span>';
                                    }
                                    if(itemVal.description != null && itemVal.description != ""){
                                        buyshopdetail+= '<span style="color:#c00">悠奇备注:'+itemVal.description+'</span>';
                                    }
                                    buyshopdetail+= '</div><div class="Remarks"><p>'+'商品备注：'+itemVal.comment+'</p></div></div></td><td class="r3">￥'+itemVal.price+'</td>';
                                    buyshopdetail+= '<td class="r4"></td><td class="r5">';
                                        if(orderVal.status != <?php echo Application_Model_ingstore::STATE_IN;?> && orderVal.status != <?php echo Application_Model_ingstore::STATE_OUT;?>){
                                            buyshopdetail+= '<dd><a class="quxiao isProblem" href="javascript:void(0)" name="onlinesingProblem" i="'+itemVal.id+'" style="margin-right: 0px;"><span style="padding: 0 5px;">问题<font '+(itemVal.problemNum>0?"style='color:#c00;'":"")+'">('+itemVal.problemNum+')</font></span></a></dd></dl>';
                                        }else { 
                                                buyshopdetail+= '<dt><span style="color:#c00;">已入库</span></dt>';
                                            }
                                    buyshopdetail+= '</td></tr></table>';
                                    buyshopdetail+= '</div>';
                                });
                                buyshopdetail+= '</div>'
                                buyshopdetail += '<div class="wtms3 orderProblemContent" name="'+orderKey+'" ></div><div class="rkyw" id="bgyh" name="'+orderKey+'" style=""></div>';
                                buyshopdetail+= '</div>'
                                i++;
                            });
                            $(".arrOrder").html(buyshopdetail);
                            $("#buyshopdiv").show();
                            $("#storediv").hide();
                            $("#qdremark").hide();
                            $("#productselect").hide();
                            break;
                        case "换货包裹":                        
                            $('#returnReason').html(data.infoArr.returnReason);
                            $('#productName').val(data.infoArr.name+"换货");
                            $(".rkzc .isExamine").attr("name","rerExamine");
                            $(".rkzc .isProblem").attr("name","rerProblem");
                            $(".rk1 #returnReasonBox").show();
                            break;
                    }
                    
                    var userdetail = '<p>当前库存：<a href="/admini/managestore/index/quick/'+data.userInfo.storeno+'">'+data.userInfo.countstore+'</a>';
                    userdetail+= '<span>|</span>帐号：<a href="javascript:void(0)">'+data.userInfo.email+'</a>';
                    userdetail+= '<span>|</span>昵称：<a href="javascript:void(0)" id="usernikename">'+data.userInfo.nikename+'</a>';
                    userdetail+= '<span>|</span>用户ID：'+data.userInfo.userId+'</p>';
                    $('#userid').val(data.userInfo.userId);
                    $(".rukuxinfo").html(userdetail);
                    $("#logisticName").val(data.infoArr.shipType);
                    $("#storeno").val(data.userInfo.storeno);
                    $('div#loginstoreno').text(data.userInfo.storeno);
                    $('div#loginname').text(data.userInfo.nikeName);
                    if(data.userInfo.userRemark){
                        $('div#userRemark').text("用户备注："+data.userInfo.userRemark);
                    }
                    $('div#usernikename').text(data.userInfo.nikeName);
                    var kuwei = '';
                    var kwtj = "";
                    if(data.userInfo.storeLocation == 0){
                        kuwei+= '<li>悠奇个人云仓库</li>';
                        kwtj = '<li>无</li>';
                    }else{
                        $.each(data.userInfo.storeLocation, function(key, val) {
                            kuwei+= '<li><i></i>'+val+'</li>';
                            kwtj = '<li><input class="input3 w30" type="text" value="'+val+'" style="width:40px;"/></li>';
                        });
                    }

                    kuwei+= '</ul>';
                    $(".kuwei").html("<label>现有库位：</label><ul>"+kuwei);
                    $(".rkzuo ul.kwtj").html(kwtj);
                    $("#printform ul.kwtj").html(kuwei);
                    
                }, 'json');
            }else{
                $("#wldh").show();
            }
        });
        
        $(".isExamine").live("click",function(){
            var examineType = $(this).attr("name");
            var storeId = $("#storeId").val();
            var intype = $("#intype").val();
            if(storeId == ""){
                alert("请填写物流单号！");
                return false;
            }
            $(".rkwt").show();
            $(".isExamine").hide();
        });
        
        $(".isProblem").live("click",function(){
            var examineType = $(this).attr("name");
            var intype = $("#intype").val();
            var storeId = $("#storeId").val();
//            var html ;
            if(intype == "自助包裹"){
                alert("自助包裹出现问题，请把问题描述写在包裹名称上，方便用户看到与卖家联系。");
                return ;
            }
            if(intype == "代购订单"){
                storeId = $(this).attr("i");
            }
            if(intype == "网购包裹"){
                storeId = $(this).attr("i");
            }
            if(storeId == ""){
                alert("请填写物流单号！");
                return false;
            }
            $("#subIsProblem").attr("name",examineType);
            $.post('/admini/managestore/problemcontent', {'storeid':storeId,'examineType':examineType}, function(data){

                if(data.status == 1){
                    $(".wt_nav li").hide();
                    $(".wt_nav li").removeClass("wt_on");
                    $(".wt_nav li[name='"+examineType+"']").addClass("wt_on").show();
                    $(".wt_center").html("");
                    $(".problem_box").hide();
                    $("#problemContent").val("");
                    $("#orderProblemImg").val("")
                    var html = "<table style='width:100%;'><tr><td style='width:20%;'>时间</td><td>内容</td><td style='width:10%;'>添加人</td><td style='width:10%;'>状态</td><td style='width:10%;'>操作</td></tr>";
                        html +="<input type='hidden' name='online' value='"+storeId+"'>";
                    $.each(data.contentArr,function(contentItem,contentVal){
                        html += "<tr><td>"+contentVal.dateCreated+"</td>";
                        html += "<td>"+contentVal.content+"</td>";
                        html += "<td>"+contentVal.operator+"</td>";
                        html += "<td>"+contentVal.statusName+"</td><td>";
                        if(contentVal.status == 0){
                            html += "<a href='javascript:void(0)' class='indexa delProblem' name='"+contentItem+"'>删除</a>";
                        } else {
                            html += "已经处理";
                        }
                        html += "</td></tr>";
                        if(contentVal.arrImg){
                            html += "<tr><td colspan='5'><div style='width:100%;height:56px;padding:3px;overflow: auto;'>";
                            $.each(contentVal.arrImg,function(imgItem,imgVal){
                               html += "<a href='<?php echo $this->cdn;?>"+imgVal.imgUrl+"' target='_blank'><img src='<?php echo $this->cdn;?>"+imgVal.img+"' style='width:50px;height:50px;margin-right:5px' /></a>"; 
                            });
                            html += "</div></td></tr>";
                        }
                        html += "<tr class='AbnormalDispose"+contentItem+"' style='border-bottom: #c00 solid 1px;'><td>处理异常：</td><td colspan='4'><div class='disposeContent"+contentItem+"' style='width:98%;'><ul>";
                        if(contentVal.arrTrack){
                            $.each(contentVal.arrTrack,function(trackKey,trackVal){
                                html += "<li>"+trackVal.dateCreated+"&nbsp;&nbsp;"+trackVal.content+"&nbsp;&nbsp;-----&nbsp;&nbsp;"+trackVal.operator+"</li>";
                            }) ;
                        }
                        html += "</ul></div></td></tr>";
                    });
                    html += "</table>";
                    $(".wt_center").html(html);
                    $(".wenti_box").show();
                    $(".tanchuang").show();
                    $(".houtai_overlay").show();
                    if(intype == "代购订单"){
                        $(".isProblem[name='"+examineType+"'][i='"+storeId+"'] span").html("问题<font "+(data.problemNum>0?"style='color:#c00;'":"")+">("+data.problemNum+")</font>");
                        $("#orderId").val(storeId);
                    } else if(intype == "网购包裹"){
                        $(".isProblem[name='"+examineType+"'][i='"+storeId+"'] span").html("问题<font "+(data.problemNum>0?"style='color:#c00;'":"")+">("+data.problemNum+")</font>");
                        $("#orderId").val(storeId);
                    } else {
                        $(".isProblem[name='"+examineType+"'] span").html("问题<font "+(data.problemNum>0?"style='color:#c00;'":"")+">("+data.problemNum+")</font>");
                    }
                } else {
                    alert("不存在该包裹，请检查物流单号！");
                    return false;
                }
            }, 'json');
            
        });
        
        $("#subIsProblem").click(function(){
            var examineType = $(this).attr("name");
            var orderId = $("#orderId").val();
            var problemContent = $("#problemContent").val();
            var intype = $("#intype").val();
            var orderProblemImg = $("#orderProblemImg").val();
            var isAbnormal = 0;
            if(orderId == ""){
                alert("请填写物流单号！");
                return false;
            }
            if(problemContent == ""){
                alert("请填写问题详情！");
                return false;
            }
            if(orderProblemImg == ""){
                alert("请上传问题图片！");
                return false;
            }
            if(intype == "代购订单"){
                isAbnormal = $(".wt_type input[name='isAbnormal']:checked").val();
            }
            if(intype == "网购包裹"){
                orderId = $("input[name='online']").val();;
            }
             if(intype == "网购包裹"){
                isAbnormal = $(".wt_type input[name='isAbnormal']:checked").val();
            }
            $.post('/admini/managestore/isproblem', {'storeid':orderId,'examineType':examineType,"problemContent":problemContent,'isAbnormal':isAbnormal,'orderProblemImg':orderProblemImg}, function(data){
                if(data.status == 1){
                    if(intype == "代购订单"){
                        if(data.isUnbin){
                            $("#submit").unbind("click");
                            $(".errorMessage").show();
                        }
                        $(".isProblem[i='"+orderId+"']").click();
                    } else if(intype == "网购包裹"){
                        $(".isProblem[i='"+orderId+"']").click();
                    } else {
                        $(".rkzc .isProblem").click();
                    }
                }  else {
                    alert("不存在该包裹，请检查物流单号！");
                    return false;
                }
            }, 'json');
        });
        
        $(".delProblem").live("click",function(){
            var contentId = $(this).attr("name");
            var intype = $("#intype").val();
            var orderId = $("#orderId").val();
            $.post('/admini/managestore/delproblem', {'contentId':contentId}, function(data){
                if(data.status == 1){
                    if(intype == "代购订单"){
                        $(".isProblem[i='"+orderId+"']").click();
                    } else if(intype == "网购包裹"){
                        $(".isProblem[i='"+orderId+"']").click();
                    } else {
                        $(".isProblem").click();
                    }
                } else {
                    alert("不存在该问题，请检查物流单号！");
                    return false;
                }
            }, 'json');
        });
        
        $(".showProblem").live("click",function(){
            var orderId = $(this).attr("name");
            $(".wt_nav li").hide();
            $(".wt_nav li").removeClass("wt_on");
            $(".wt_nav li[name='orderProblemShow']").addClass("wt_on").show();
            $(".wenti_box").hide();
            $.post('/admini/managestore/showproblem', {'orderId':orderId}, function(data){
                if(data.status == 1){
                    var html = "";
                    $.each(data.problemContent,function(problemKey,problemVal){
                        html += '<div class="'+(problemVal.issueetype==1?'wt_uuch':'wt_kehu')+'">';
                        html += '<h2>'+(problemVal.issueetype==1?'悠奇客服':('用户回复'));
                        html += '<span>'+problemVal.dateCreated+'</span></h2>';
                        html += '<p>'+problemVal.content+'</p></div>';
                     });
                     $(".problem_center").html(html);
                     
                    $(".problem_box").show();
                    $(".tanchuang").show();
                    $(".houtai_overlay").show();
                } else {
                    alert("不存在该包裹，请检查物流单号！");
                    return false;
                }
            }, 'json');
        });
        
        $(".rkzc .yzcx").live("click",function(){
            var examineType = $(this).attr("name");
            var intype = $("#intype").val();
            var storeId = $("#storeId").val();
            if(storeId == ""){
                alert("请填写物流单号！");
                return false;
            }
            $(".rkwt").hide();
            $(".isExamine").show();
        });
        $(".itemExamine").live("click",function(){
            var i = $(this).attr("name");
            var yiyan = '<span class="yiyan">已验</span>';
            $("#div"+i).addClass("yy");
            $("#tr"+i+' .r1').html(yiyan);
            $("#tr"+i+' .r5 .itemExamine').hide();
            $("#tr"+i+' .r5 .isProblem').hide();
            $("#tr"+i+' .r5 .yzcx').show();
        });
        $(".r5 .yzcx").live("click",function(){
            var i = $(this).attr("name");
            $("#div"+i).removeClass("yy");
            $("#tr"+i+' .r1').html("");
            $("#tr"+i+' .r5 .itemExamine').show();
            $("#tr"+i+' .r5 .isProblem').show();
            $("#tr"+i+' .r5 .yzcx').hide();
        });
        $(".cultVisiting").click(function(){
            $(".cultShipFee").show();
            $(".tanchuang").show();
            $(".houtai_overlay").show();
            $(".wt_nav li").removeClass("wt_on");
            $(".wt_nav li[name='visitingShipFee']").addClass("wt_on").show();
        });
        $(".nui-msgbox-close,.nui-btn-text,#subVisitingFee").click(function(){
            $(".houtai_overlay").hide();
            $(".tanchuang").hide();
        });
        $(".visitingCult").click(function(){
            var visitingWeight = $("#visitingWeight").val();
            if(visitingWeight == "" || visitingWeight == 0) {
                alert("上门取件包裹的重量不能为空！");
                return false;
            }
            var visitingVolumeWeight = $("#visitingVolumeWeight").val();
            var visitingId = $("#visitingId").val();
            $.post("/admini/managestore/cultvisiting",{"visitingId":visitingId,"visitingWeight":visitingWeight,"visitingVolumeWeight":visitingVolumeWeight},function(data){
                if(data.type == 1) {
                    $("#visitingFee").val(data.shipFee);
                    $("#cnShipFee").val(data.shipFee);
                } else {
                    alert("出现未知错误！");
                }
            });
        });
        $('#length,#width,#height').change(function(){
            var length = parseFloat($('#length').val());
            if(typeof(length) == 'NaN')
                length = 0;
            var width = parseFloat($('#width').val());
            if(typeof(width) == 'NaN')
                width = 0;
            var height = parseFloat($('#height').val());
            if(typeof(height) == 'NaN')
                height = 0;
            if(length*width*height>0){
                $('#volumeWeight').val(length*width*height/5000);
                var weight = parseFloat($('#weight').val());
                var volumeWeight = parseFloat($('#volumeWeight').val());
                var volumeWeightSelected = parseFloat(volumeWeight/weight);
                if(volumeWeightSelected <= 1)
                {
                    $("#bignessType").attr("value",'0');
                }
                else if(volumeWeightSelected > 1 && volumeWeightSelected <= 1.3)
                {
                    $("#bignessType").attr("value",'1');
                }
                else if(volumeWeightSelected > 1.3 && volumeWeightSelected <= 1.6)
                {
                     $("#bignessType").attr("value",'2');       
                }
                else if(volumeWeightSelected > 1.6)
                {   
                     $("#bignessType").attr("value",'3');
                }  
            }else{
               $('#volumeWeight').val(); 
            }
        });
        $('#visitingLength,#visitingWidth,#visitingHeight').change(function(){
            var length = parseFloat($('#visitingLength').val());
            if(typeof(length) == 'NaN')
                length = 0;
            var width = parseFloat($('#visitingWidth').val());
            if(typeof(width) == 'NaN')
                width = 0;
            var height = parseFloat($('#visitingHeight').val());
            if(typeof(height) == 'NaN')
                height = 0;
            if(length*width*height>0){
                var volume = (length*width*height/6000).toFixed(3);
                $('#visitingVolumeWeight').val(volume);
            } else {
                $('#visitingVolumeWeight').val("0");
            }
        });
        $('#volumeWeight').change(function(){
            var weight = parseFloat($('#weight').val());
            var volumeWeight = parseFloat($('#volumeWeight').val());
            var volumeWeightSelected = parseFloat(volumeWeight/weight);
            if(volumeWeightSelected <= 1)
            {
                $("#bignessType").attr("value",'0');
            }
            else if(volumeWeightSelected > 1 && volumeWeightSelected <= 1.3)
            {
                $("#bignessType").attr("value",'1');
            }
            else if(volumeWeightSelected > 1.3 && volumeWeightSelected <= 1.6)
            {
                 $("#bignessType").attr("value",'2');       
            }
            else if(volumeWeightSelected > 1.6)
            {   
                 $("#bignessType").attr("value",'3');
            }  
        });
        $("#visitingWeight,#visitingVolumeWeight").focusout(function(){
            $(".visitingCult").click();
        });
        $("#courier").change(function(){
            $('#logisticName').val($(this).children('option:selected').val());
            $('#logisticName').focus();
        });
        $("#productselect").change(function(){
            $('#productName').val($(this).children('option:selected').val());
            $('#productName').focus();
        });
        
        function inspection(){
            var logistics = $('#logistics').val();
            $.post(
                '/admini/managestore/inspection',
                {'logistics':logistics},
                function (data){
                   if(data === 1){
                       $('#inspection div.rkzc').html("已验货");
                   }else{
                       alert("验货失败！");
                   } 
                }
            ,'json');
        }
        
        function abnormal(){
            $('.tanchuang').show();
            $(".houtai_overlay").show();
            $("#storetitle").show();
            $('#storetitle').html("退换货包裹出现异常");
        }
    </script>

    <script type="text/javascript">
    var swfu;

    window.onload = function() {
        var settings = {
            flash_url : "/js/swfupload/swfupload.swf",
            upload_url: "/admini/ajax/newupload",
            post_params: {"PHPSESSID" : ""},
            file_size_limit : "100 MB",
            file_types : "*.jpg",
            file_types_description : "All Files",
            file_upload_limit : 100,
            file_queue_limit : 0,
            custom_settings : {
                progressTarget : "fsUploadProgress",
                cancelButtonId : "btnCancel"
            },
            debug: false,

            // Button settings
            //button_image_url: "images/TestImageNoText_65x29.png",
            button_width: "65",
            button_height: "29",
            button_placeholder_id: "spanButtonPlaceHolder",
            button_text: '<span class="theFont">上传</span>',
            button_text_style: ".theFont { font-size: 16; }",
            button_text_left_padding: 12,
            button_text_top_padding: 3,

            // The event handler functions are defined in handlers.js
            file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_start_handler : uploadStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : function(file,data){
                var imgurl = 'http://old.uuch.com/data/'+$.parseJSON(data);
                $('#image').val(imgurl);
                $("#video").hide();
                $("#showimg").attr("src", 'http://old.uuch.com/big/data/'+$.parseJSON(data));
                $("#showimg").show();
                var progress = new FileProgress(file, this.customSettings.progressTarget);
                progress.setComplete();
                progress.setStatus("Complete.");
                progress.toggleCancel(false);
            },
            upload_complete_handler : uploadComplete,
            queue_complete_handler : queueComplete	// Queue plugin event

        };
        var problemImg = {
            flash_url : "/js/swfupload/swfupload.swf",
            upload_url: "/admini/ajax/newupload",
            post_params: {"PHPSESSID" : ""},
            file_size_limit : "100 MB",
            file_types : "*.jpg",
            file_types_description : "All Files",
            file_upload_limit : 100,
            file_queue_limit : 0,
            custom_settings : {
                progressTarget : "fsUploadProgress",
                cancelButtonId : "btnCancel"
            },
            debug: false,

            // Button settings
            //button_image_url: "images/TestImageNoText_65x29.png",
            button_width: "75",
            button_height: "29",
            button_placeholder_id: "spanButtonPlaceHolder_ProblemImg",
            button_text: '<span class="theFont">上传图片</span>',
            button_text_style: ".theFont { font-size: 16; }",
            button_text_left_padding: 12,
            button_text_top_padding: 3,

            // The event handler functions are defined in handlers.js
            file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_start_handler : uploadStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : function(file,data){
                var imgurl = 'http://old.uuch.com/data/'+$.parseJSON(data);
                $('#orderProblemImg').val(imgurl);
                alert("上传成功");
                var progress = new FileProgress(file, this.customSettings.progressTarget);
                progress.setComplete();
                progress.setStatus("Complete.");
                progress.toggleCancel(false);
            },
            upload_complete_handler : uploadComplete,
            queue_complete_handler : queueComplete	// Queue plugin event

        };
        swfu = new SWFUpload(settings);
        new SWFUpload(problemImg);
    };
</script>